package com.example.rfb.myapplication0.activity;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

import com.example.rfb.myapplication0.R;
import com.example.rfb.serviceloader.AnnotationServiceLoader;
import com.example.rfb.test.ITest;

import java.util.Iterator;

import androidx.annotation.Nullable;

public class MyActivity extends Activity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_my);

        findViewById(R.id.btn_test)
                .setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {

                        Iterator<ITest> iterator = AnnotationServiceLoader.load(ITest.class).iterator();
                        while (iterator.hasNext()){
                            iterator.next().test();
                        }
                    }
                });
    }
}
